![]() |
ALMaSS
1.0
The Animal, Landscape and Man Simulation System
|
#include <skylarks_all.h>
Public Member Functions | |
void | Tick (void) |
void | EvaluateAllTerritories (void) |
void | PreCachePoly (int a_poly) |
double | PrePoly2Qual (int a_poly) |
double | PrePolyNQual (int a_poly, int *a_good_polys) |
void | PreProcessLandscape2 (Landscape *L) |
void | ClaimGrid (int x, int y, int range) |
void | UpdateQuality () |
bool | IsGridPositionValid (int &x, int &y, int range) |
bool | IsExtGridPositionValid (int &x, int &y, int range) |
int | IsValid (int nx, int ny) |
void | GetTerritoriesByDistance (int nx, int ny, vector< APoint > *alist) |
int | Supply_quality (int ref) |
int | Supply_x (int ref) |
int | Supply_y (int ref) |
int | Supply_size (int ref) |
skTTerritory * | Supply_terr (int ref) |
void | RemoveFemale (int ref) |
void | RemoveMale (int ref) |
void | Split (int ref) |
Skylark_Male * | Supply_Owner (int ref) |
Skylark_Female * | Supply_F_Owner (int ref) |
void | Occupy (int ref, Skylark_Male *Male) |
void | FemaleOccupy (int ref, Skylark_Female *Female) |
double | EvaluateHabitatN (skTTerritory *a_terr) |
int | SupplyNoTerritories () |
int | SupplyNoMaleOccupied () |
int | SupplyNoFemaleOccupied () |
bool | SupplyIsNestValid (int ref) |
APoint | SupplyNestPosition (int ref) |
SkTerritories (Landscape *L) | |
~SkTerritories () | |
Public Attributes | |
int | PolyRefData [2500] |
int | PolySizeData [2500] |
double | PolyHeightData [2500] |
TTypesOfLandscapeElement | PolyTypeData [2500] |
Landscape * | TheLandscape |
Private Member Functions | |
int | EvaluateHabitatSquare (int xmin, int xmax, int ymin, int ymax, int NoPolygons) |
int | PreMakeForIterator (int a_min_incl, int a_max_excl, int *a_iter, int a_norm_max_excl) |
void | PreFillTerrPolyLists (skTTerritory *a_terr) |
void | PreFillQualGrid (void) |
void | PreEvaluateQualGrid (SkQualGrid *a_grid, int a_x, int a_y, int a_width, int a_height) |
void | PreFillQualCache (void) |
int | PreEvaluateHabitat (int a_x, int a_y, int a_range_x, int a_range_y) |
int | PreEvaluateHabitatStripX (int a_x, int a_y, int a_range_x) |
int | PreEvaluateHabitatStripY (int a_x, int a_y, int a_range_x) |
void | DumpMapGraphics (const char *a_filename, Landscape *a_map) |
Private Attributes | |
skTTerritory * | Territories [400000] |
int | NoTerritories |
int | SimW |
int | SimH |
bool * | Grid |
int | m_sim_w_div_10 |
int | m_sim_h_div_10 |
int | m_qual_grid_signal |
SkQualGrid ** | m_qual_grid |
int | m_hash_size |
int * | m_poly_seen |
int * | m_poly_size |
double * | m_qual_cache |
bool | m_qual_cache_filled |
int | m_for_iter_x [1000] |
int | m_for_iter_y [1000] |
SkTerritories::SkTerritories | ( | Landscape * | L | ) |
SkTerritories::~SkTerritories | ( | ) |
References m_poly_seen, m_poly_size, m_qual_cache, m_qual_grid, m_sim_h_div_10, m_sim_w_div_10, NoTerritories, and Territories.
void SkTerritories::ClaimGrid | ( | int | x, |
int | y, | ||
int | range | ||
) |
|
private |
References g_msg, skTTerritory::m_Location_x, skTTerritory::m_Location_y, NoTerritories, skTTerritory::Size, Landscape::SupplyElementType(), Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), Landscape::SupplyVegHeight(), Territories, tole_Field, MapErrorMsg::Warn(), and WARN_FILE.
void SkTerritories::EvaluateAllTerritories | ( | void | ) |
References EvaluateHabitatN(), NoTerritories, and Territories.
Referenced by Skylark_Population_Manager::DoFirst().
double SkTerritories::EvaluateHabitatN | ( | skTTerritory * | a_terr | ) |
References g_land, skTTerritory::m_competitionscaler, skTTerritory::m_polys, skTTerritory::m_sizes, PrePolyNQual(), skTTerritory::SetQuality(), and Landscape::Warn().
Referenced by EvaluateAllTerritories().
|
private |
void SkTerritories::FemaleOccupy | ( | int | ref, |
Skylark_Female * | Female | ||
) |
References skTTerritory::F_Owner, and Territories.
Referenced by Skylark_Female::EstablishTerritory(), and Skylark_Male::OnReHouse().
void SkTerritories::GetTerritoriesByDistance | ( | int | nx, |
int | ny, | ||
vector< APoint > * | alist | ||
) |
References CompareDist(), APoint::m_x, APoint::m_y, NoTerritories, and Territories.
Referenced by Skylark_Male::OnEvicted(), and Skylark_Male::st_Arriving().
bool SkTerritories::IsExtGridPositionValid | ( | int & | x, |
int & | y, | ||
int | range | ||
) |
bool SkTerritories::IsGridPositionValid | ( | int & | x, |
int & | y, | ||
int | range | ||
) |
int SkTerritories::IsValid | ( | int | nx, |
int | ny | ||
) |
References NoTerritories, and Territories.
void SkTerritories::Occupy | ( | int | ref, |
Skylark_Male * | Male | ||
) |
References skTTerritory::Owner, and Territories.
Referenced by Skylark_Male::EstablishingATerritory().
void SkTerritories::PreCachePoly | ( | int | a_poly | ) |
|
inlineprivate |
References SkQualGrid::m_qual, m_qual_grid, m_sim_h_div_10, and m_sim_w_div_10.
Referenced by PreProcessLandscape2().
|
inlineprivate |
References SkQualGrid::m_qual, m_qual_grid, and m_sim_w_div_10.
Referenced by PreProcessLandscape2().
|
inlineprivate |
References SkQualGrid::m_qual, m_qual_grid, m_sim_h_div_10, and m_sim_w_div_10.
Referenced by PreProcessLandscape2().
|
private |
References SkQualGrid::Insert(), m_poly_seen, SkQualGrid::m_polys, SkQualGrid::m_qual, m_qual_cache, SkQualGrid::m_sizes, PolyRefData, Landscape::SupplyPolyRef(), and TheLandscape.
Referenced by PreFillQualGrid().
|
private |
This method is called only once since the male cues on returning to the landscape are thought to be structural and not vegatation based (e.g. he waits in ploughed fields). Later he will use the same assessment as the females, but this is not possible early in the season before vegetation grows.
References m_hash_size, m_poly_seen, SkQualGrid::m_polys, m_qual_cache, m_qual_cache_filled, m_qual_grid, m_sim_h_div_10, m_sim_w_div_10, and PrePoly2Qual().
|
private |
References g_land, g_msg, m_hash_size, m_poly_seen, m_poly_size, m_qual_cache, m_qual_grid, m_qual_grid_signal, m_sim_h_div_10, m_sim_w_div_10, PreEvaluateQualGrid(), Landscape::SkylarkEvaluation(), Landscape::SupplyLargestPolyNumUsed(), TheLandscape, MapErrorMsg::Warn(), and WARN_FILE.
Referenced by PreProcessLandscape2().
|
private |
References HomeRangeDiameterDiv20, m_for_iter_x, m_for_iter_y, skTTerritory::m_hr_polys, skTTerritory::m_hr_sizes, m_poly_seen, m_poly_size, skTTerritory::m_polys, SkQualGrid::m_polys, m_qual_grid, skTTerritory::m_range_div10, m_sim_h_div_10, m_sim_w_div_10, skTTerritory::m_sizes, SkQualGrid::m_sizes, skTTerritory::m_x_div10, skTTerritory::m_y_div10, PolyRefData, and PreMakeForIterator().
Referenced by PreProcessLandscape2(), and Split().
|
private |
Referenced by PreFillTerrPolyLists().
|
inline |
Used only on start-up when potential territories need to be determined.
References HQualityBareEarth, HQualityHedge, HQualityHedgeScrub, HQualityMetalRoad, HQualityTall, HQualityTall2, HQualityTallVeg, HQualityWater, PatchyPremium, SKOPTIMALHABITATSCORE, Landscape::SupplyElementType(), Landscape::SupplyVegHeight(), Landscape::SupplyVegPatchy(), TheLandscape, tole_ActivePit, tole_AmenityGrass, tole_BeetleBank, tole_Building, tole_BuiltUpWithParkland, tole_Carpark, tole_Churchyard, tole_Coast, tole_ConiferousForest, tole_Copse, tole_DeciduousForest, tole_Fence, tole_Field, tole_FieldBoundary, tole_FishFarm, tole_Foobar, tole_Freshwater, tole_Garden, tole_Heath, tole_HedgeBank, tole_Hedges, tole_HeritageSite, tole_IndividualTree, tole_LargeRoad, tole_Marsh, tole_MetalledPath, tole_MixedForest, tole_MownGrass, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_Parkland, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_PitDisused, tole_PlantNursery, tole_Pond, tole_Pylon, tole_Railway, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_RoadsideSlope, tole_RoadsideVerge, tole_Saltmarsh, tole_Saltwater, tole_SandDune, tole_Scrub, tole_SmallRoad, tole_StoneWall, tole_Stream, tole_Track, tole_UnknownGrass, tole_UnsprayedFieldMargin, tole_UrbanNoVeg, tole_UrbanPark, tole_Vildtager, tole_Wasteland, tole_WindTurbine, tole_WoodlandMargin, tole_WoodyEnergyCrop, tole_YoungForest, and Landscape::Warn().
Referenced by PreCachePoly(), and PreFillQualCache().
|
inline |
References cfg_SkScrapesPremiumII, cfg_SkTramlinesPremium, DensityScore, HeightScore, HQualityBareEarth, HQualityHedge, HQualityHedgeScrub, HQualityMetalRoad, HQualityTall, HQualityTall2, HQualityTallVeg, HQualityWater, PatchyPremium, SKOPTIMALHABITATSCORE, Landscape::SupplyElementType(), Landscape::SupplyHasTramlines(), Landscape::SupplySkScrapes(), Landscape::SupplyVegDensity(), Landscape::SupplyVegHeight(), Landscape::SupplyVegPatchy(), TheLandscape, tole_ActivePit, tole_AmenityGrass, tole_BeetleBank, tole_Building, tole_BuiltUpWithParkland, tole_Carpark, tole_Churchyard, tole_Coast, tole_ConiferousForest, tole_Copse, tole_DeciduousForest, tole_Fence, tole_Field, tole_FieldBoundary, tole_FishFarm, tole_Foobar, tole_Freshwater, tole_Garden, tole_Heath, tole_HedgeBank, tole_Hedges, tole_HeritageSite, tole_IndividualTree, tole_LargeRoad, tole_Marsh, tole_MetalledPath, tole_MixedForest, tole_MownGrass, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_Parkland, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_PitDisused, tole_PlantNursery, tole_Pond, tole_Pylon, tole_Railway, tole_River, tole_RiversidePlants, tole_RiversideTrees, tole_RoadsideSlope, tole_RoadsideVerge, tole_Saltmarsh, tole_Saltwater, tole_SandDune, tole_Scrub, tole_SmallRoad, tole_StoneWall, tole_Stream, tole_Track, tole_UnknownGrass, tole_UnsprayedFieldMargin, tole_UrbanNoVeg, tole_UrbanPark, tole_Vildtager, tole_Wasteland, tole_WindTurbine, tole_WoodlandMargin, tole_WoodyEnergyCrop, tole_YoungForest, CfgInt::value(), CfgFloat::value(), and Landscape::Warn().
Referenced by EvaluateHabitatN().
void SkTerritories::PreProcessLandscape2 | ( | Landscape * | L | ) |
References cfg_FemaleMinTerritoryAcceptScore, ClaimGrid(), g_rand_uni, Grid, IsExtGridPositionValid(), IsGridPositionValid(), m_sim_h_div_10, m_sim_w_div_10, NoTerritories, PreEvaluateHabitat(), PreEvaluateHabitatStripX(), PreEvaluateHabitatStripY(), PreFillQualGrid(), PreFillTerrPolyLists(), random(), Territories, skTTerritory::TestNestPossibility(), CfgFloat::value(), and Landscape::Warn().
Referenced by Skylark_Population_Manager::DoFirst().
void SkTerritories::RemoveFemale | ( | int | ref | ) |
References skTTerritory::F_Owner, and Territories.
Referenced by Skylark_Female::OnMateDying(), Skylark_Female::st_Dying(), Skylark_Female::st_GivingUpTerritory(), and Skylark_Female::st_StoppingBreeding().
void SkTerritories::RemoveMale | ( | int | ref | ) |
References skTTerritory::Owner, and Territories.
Referenced by Skylark_Male::OnEvicted(), Skylark_Male::OnMateLeaving(), Skylark_Male::st_AttractingAMate(), Skylark_Male::st_Dying(), and Skylark_Male::st_FollowingMate().
void SkTerritories::Split | ( | int | ref | ) |
Duplicates the old territory.
Reduces the virtual size.
References cfg_MaleSplitScale, skTTerritory::GetVirtualDiameter(), skTTerritory::m_competitionscaler, NoTerritories, PreFillTerrPolyLists(), skTTerritory::SetNestPossibility(), skTTerritory::SetVirtualDiameter(), Territories, and CfgFloat::value().
Referenced by Skylark_Male::ReEvaluateTerritory().
Skylark_Female * SkTerritories::Supply_F_Owner | ( | int | ref | ) |
References skTTerritory::F_Owner, and Territories.
Referenced by Skylark_Female::st_Finding_Territory().
Skylark_Male * SkTerritories::Supply_Owner | ( | int | ref | ) |
References skTTerritory::Owner, and Territories.
Referenced by Skylark_Male::OnReHouse(), Skylark_Female::st_Finding_Territory(), and Skylark_Male::st_FindingTerritory().
int SkTerritories::Supply_quality | ( | int | ref | ) |
References skTTerritory::GetQuality(), and Territories.
Referenced by Skylark_Male::st_FindingTerritory(), and Skylark_Population_Manager::TheSkylarkTerrsSupply_quality().
int SkTerritories::Supply_size | ( | int | ref | ) |
References skTTerritory::Size, and Territories.
Referenced by Skylark_Male::OnReHouse(), Skylark_Male::st_FindingTerritory(), and Skylark_Population_Manager::TheSkylarkTerrsSupply_size().
skTTerritory * SkTerritories::Supply_terr | ( | int | ref | ) |
References Territories.
Referenced by Skylark_Male::ConstructAHabitatTable(), Skylark_Male::OnMateLeaving(), and Skylark_Male::ReEvaluateTerritory().
int SkTerritories::Supply_x | ( | int | ref | ) |
References skTTerritory::m_Location_x, and Territories.
Referenced by Skylark_Male::OnReHouse(), Skylark_Male::st_FindingTerritory(), and Skylark_Population_Manager::TheSkylarkTerrsSupply_x().
int SkTerritories::Supply_y | ( | int | ref | ) |
References skTTerritory::m_Location_y, and Territories.
Referenced by Skylark_Male::OnReHouse(), Skylark_Male::st_FindingTerritory(), and Skylark_Population_Manager::TheSkylarkTerrsSupply_y().
|
inline |
References skTTerritory::m_nest_valid.
Referenced by Skylark_Male::OnReHouse(), and Skylark_Male::st_FindingTerritory().
|
inline |
int SkTerritories::SupplyNoFemaleOccupied | ( | ) |
References NoTerritories, and Territories.
int SkTerritories::SupplyNoMaleOccupied | ( | ) |
References NoTerritories, and Territories.
int SkTerritories::SupplyNoTerritories | ( | ) |
|
inline |
Referenced by Skylark_Population_Manager::DoFirst().
void SkTerritories::UpdateQuality | ( | ) |
|
private |
Referenced by ClaimGrid(), IsExtGridPositionValid(), IsGridPositionValid(), PreProcessLandscape2(), and SkTerritories().
|
private |
Referenced by PreFillTerrPolyLists().
|
private |
Referenced by PreFillTerrPolyLists().
|
private |
Referenced by PreFillQualCache(), and PreFillQualGrid().
|
private |
Referenced by PreEvaluateQualGrid(), PreFillQualCache(), PreFillQualGrid(), PreFillTerrPolyLists(), and ~SkTerritories().
|
private |
Referenced by PreFillQualGrid(), PreFillTerrPolyLists(), and ~SkTerritories().
|
private |
Referenced by PreCachePoly(), PreEvaluateQualGrid(), PreFillQualCache(), PreFillQualGrid(), and ~SkTerritories().
|
private |
Referenced by PreFillQualCache().
|
private |
|
private |
Referenced by PreFillQualGrid(), and SkTerritories().
|
private |
|
private |
|
private |
double SkTerritories::PolyHeightData[2500] |
int SkTerritories::PolyRefData[2500] |
Referenced by PreEvaluateQualGrid(), and PreFillTerrPolyLists().
int SkTerritories::PolySizeData[2500] |
TTypesOfLandscapeElement SkTerritories::PolyTypeData[2500] |
|
private |
Referenced by SkTerritories().
|
private |
Referenced by SkTerritories().
|
private |
Referenced by DumpMapGraphics(), EvaluateAllTerritories(), FemaleOccupy(), GetTerritoriesByDistance(), IsValid(), Occupy(), PreProcessLandscape2(), RemoveFemale(), RemoveMale(), Split(), Supply_F_Owner(), Supply_Owner(), Supply_quality(), Supply_size(), Supply_terr(), Supply_x(), Supply_y(), SupplyNoFemaleOccupied(), SupplyNoMaleOccupied(), and ~SkTerritories().
Landscape* SkTerritories::TheLandscape |
Referenced by PreEvaluateQualGrid(), PreFillQualGrid(), PrePoly2Qual(), PrePolyNQual(), and SkTerritories().